﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CivLib.CivNum
{
  /// <summary>
  /// Class that defines basic spatial math
  /// </summary>
  public static class SpatMath
  {
    /// <summary>
    /// Method to get the volume of a frustrum given the area of the top
    /// and bottom.  This turns into the area of a pyramid if one of the 
    /// areas is 0.
    /// </summary>
    /// <param name="area1">First area</param>
    /// <param name="area2">Second area</param>
    /// <param name="height">Height of the frustrum, normal to the areas</param>
    /// <returns>Volume of the Frustrum</returns>
    public static double FrustVol(double area1, double area2, double height)
    {
      return (height / 3) * (area1 + area2 + Math.Sqrt(area1 * area2));
    }
  }
}
